﻿<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="text" />
  <xsl:template match="/">
    
    UPDATE [<xsl:value-of select="Schema/@Owner" />].[<xsl:value-of select="Schema/@TableName" />]
    SET<xsl:for-each select="Schema/Columns[IsIdentity='false' and IsPK='0']">
      [<xsl:value-of select="ColumnName" />]=@<xsl:value-of select="ColumnName" /><xsl:if test="position()!=last()">,</xsl:if>
    </xsl:for-each>
    WHERE<xsl:for-each select="Schema/Columns[IsPK='1']">
      [<xsl:value-of select="ColumnName" />]=@<xsl:value-of select="ColumnName" /><xsl:if test="position()!=last()"> AND </xsl:if>
    </xsl:for-each>
   
  </xsl:template>
</xsl:stylesheet>